/*
 * Servo.cpp
 *
 *  Created on: Jan 29, 2010
 *      Author: fmason
 */
#include "ServoMotor.h"

void ServoMotor::attach( int pin )
{
  servo.attach( pin );
}

void ServoMotor::setup()
{
	servo.attach( SERVO );
	moveTo( MIDDLE );
	//delay( SERVO_DELAY );
}

void ServoMotor::takedown()
{
	moveTo( MIDDLE );
}

void ServoMotor::moveTo( int angle )
{
	//protect the motor
	if( angle < 0 || angle > 180 )
	{
		return;
	}

	servo.write( angle );
	//delay( SERVO_DELAY );
}

//Need a function to get the current position of servo


